<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>请选择栏目</title>
<link href="/css/admin.css" rel="stylesheet" type="text/css" />
<script src="/js/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="/js/jquery-ui-1.8.14/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
<link href="/js/dynatree-1.1.1/skin-vista/ui.dynatree.css" rel="stylesheet" type="text/css" />
<script src="/js/dynatree-1.1.1/jquery.dynatree.js" type="text/javascript"></script>
<script type="text/javascript">
	$(function () {
		$("#tree").dynatree({
			checkbox: true,
			// Override class name for checkbox icon:
			<?php if(empty($multi)){?>
			classNames: {checkbox: "dynatree-radio"},
			selectMode: 1,
			<?php } else {?>
			selectMode: 2,
			<?php }?>
			imagePath: "/images/", 				
			initAjax: {
				url: "/cms/doLoadColumn/<?=$sid?>"//,
				//data: { id: "" }
			},
			onSelect: function(select, node) {
				$("#hidcol").val(node.data.key + '|' + node.data.title);				
			},
			onDblClick: function(node, event) {
				node.toggleSelect();
			},
			onLazyRead: function (node) {
				node.appendAjax({ url: "/cms/doLoadColumn/" + node.data.key //,
					//data: { "id": node.data.key }
				});
			}
		});
    });
	function doSel()
	{
		var selectedNodes = $("#tree").dynatree("getSelectedNodes"); 
		var selectedKeys = $.map(selectedNodes, function(node){ 
            return node.data.key + '|' + node.data.title; 
        }); 
        var r = selectedKeys.join(","); 
        
		if(typeof(r) == 'undefined' ||r == ''){
			alert('请选择一个栏目!');
			return;
		}

		window.opener.setcol(r);
	    window.close();
	}
</script>
</head>
<body>
	 <div id="tree">
        </div>
	<div style="text-align:center;border-top:dashed 1px #999999;padding-top:5px;"><input type="hidden" id="hidcol" value="" /><input type="button" value=" 确定 " onclick="doSel()" />&nbsp;&nbsp;<input type="button" value="取消" onclick="self.close();"/></div>
</body>
</html>